package ru.susu.algebra.partition.filter;

import ru.susu.algebra.partition.Partition;

/**
 * @author akargapolov
 * @since: 11.03.2009
 */
public class DifferentOddFilter implements IPartitionFilter
{

	@Override
	public boolean checkPartition(Partition partition)
	{
		Integer array[] = partition.getArrayRepresentation();
		if (array[0] % 2 == 0)
			return false;
		for (int i = 1; i < array.length; i++)
			if (array[i] % 2 == 0 || array[i - 1].equals(array[i]))
				return false;
		return true;
	}

}
